home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 20 / CU Amiga Magazine's Super CD-ROM 20 (1998)(EMAP Images)(GB)[!][issue 1998-03].iso / CDsupport / Play16 / Play16daemon.rexx < prev   
OS/2 REXX Batch file  |  1997-07-29  |  3KB  |  80 lines

  1. /* $VER: Play16daemon 1.1 (29 JUL 97)
  2. ** by Charles Patterson <midian@azstarnet.com>
  3. ** http://www.azstarnet.com/~midian/
  4. **
  5. ** Description: Creates an ARexx port called PLAY and allows other
  6. **              programs to send it commands then plays sound files
  7. **              with Play16
  8. **
  9. ** Requirements: Play16 (available on Aminet)
  10. **
  11. ** Instructions: Put this file in your REXX: assign
  12. **               add RUN >NIL: rx Play16daemon to your User-startup
  13. **               Change PATH for Play16 on your system
  14. **               See Play16daemon.readme for detailed instructions on use
  15. **
  16. * ---- Path to Play16 ---- */
  17. PATH="PLAY16:Play16"
  18.  
  19. IF ~SHOW('L', "rexxsupport.library") THEN
  20.     ADDLIB("rexxsupport.library",0,-30,0)
  21.  
  22. OPENPORT("PLAY")
  23. DO FOREVER
  24.     IF WAITPKT("PLAY") THEN
  25.         DO
  26.             packet = GETPKT("PLAY")
  27.             pargs = GETARG(packet)
  28.             PARSE VAR pargs cmd sound
  29.             cmd=UPPER(cmd)
  30.  
  31.             SELECT
  32.                 WHEN cmd = "EXIT" THEN
  33.                     DO
  34.                         REPLY(packet,0)
  35.                         CLOSEPORT("PLAY")
  36.                         EXIT
  37.                     END
  38.                 WHEN cmd = "FILE" THEN
  39.                     DO
  40.                         ADDRESS COMMAND 'RUN >NIL:' PATH sound
  41.                         REPLY(packet,0)
  42.                     END
  43.                 WHEN cmd = "ID" THEN
  44.                     DO
  45.                         played=0
  46.                         IF ~OPEN('idfile','s:play.ids','R') THEN
  47.                             DO
  48.                                 SAY "Can't find s:play.ids"
  49.                                 REPLY(packet,17)
  50.                             END
  51.                         ELSE
  52.                             DO
  53.                                 DO WHILE ~EOF('idfile')
  54.                                     idline=READLN('idfile')
  55.                                     PARSE VAR idline idname soundpath idline
  56.                                     IF idname=sound THEN
  57.                                         DO
  58.                                             ADDRESS COMMAND 'RUN >NIL:' PATH soundpath
  59.                                             REPLY(packet,0)
  60.                                             played=1
  61.                                         END
  62.                                 END
  63.                                 IF ~played THEN
  64.                                     DO
  65.                                         SAY "Requested ID not found"
  66.                                         REPLY(packet,18)
  67.                                     END
  68.                                 CLOSE('idfile')
  69.                             END
  70.                     END
  71.                 OTHERWISE
  72.                     DO
  73.                         SAY "Unknown command"
  74.                         REPLY(packet,10)
  75.                     END
  76.             END
  77.         END
  78. END
  79.  
  80.